#ifndef _MY_MAP_H_
#define _MY_MAP_H_

#include "bucket.h"
#include <functional>
#include <memory>
#include <vector>

template<typename Key, typename Value, typename Hash = std::hash<Key>>
class my_map {
	public:
		my_map(const unsigned int n = NB_BUCKETS_DEFAUT, Hash h = Hash());
		my_map(const my_map& orig) = delete;
		my_map& operator = (const my_map& orig) = delete;
		
		Value value_for(const Key& key, const Value& defaultValue = Value()) const;
		void add_or_update_mapping(const Key& key, const Value& value);
		void remove(const Key& key);
		bucket<Key, Value>& getBucketIndex(const int index) const;
		
		static const int NB_BUCKETS_DEFAUT = 19;
		
	private:
		bucket<Key, Value>& getBucket(const Key& key) const;
		
		std::vector<std::unique_ptr<bucket<Key, Value>>> buckets;
		Hash hasher;
};

#include "my_map.tcc"

#endif
